import { TextList } from "../Config";
import ItemView from "./ItemView";
import GridListView from "../engine/GridListView";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GridListViewTest extends cc.Component {



    @property(GridListView)
    gridListView: GridListView = null;

    start() {
        this.gridListView.totalCount = TextList.length;
    }

    updateItem(listView, pos: number, item: cc.Node) {
        cc.log(' updateItem pos ',pos)
        let text = TextList[pos]
        let itemView: ItemView = item.getComponent(ItemView);
        itemView.content = text;
        itemView.refresh()
    }

    // update (dt) {}

    onBackClick() {
        this.node.destroy()
    }
}
